# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sylkie
pkgver=0.0.4.r3.g1cf170f
pkgrel=3
epoch=1
pkgdesc='IPv6 address spoofing with the Neighbor Discovery Protocol.'
groups=('blackarch' 'blackarch-spoof' 'blackarch-networking')
arch=('x86_64' 'aarch64')
url='https://github.com/dlrobertson/sylkie'
license=('MIT')
depends=('json-c' 'libseccomp')
makedepends=('git' 'cmake')
optdepends=('linux-headers' 'linux-lts-headers' 'linux-hardened-headers'
            'linux-rt-headers' 'linux-rt-lts-headers' 'linux-zen-headers')
source=("git+https://github.com/dlrobertson/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
}

build() {
  cd $pkgname

  mkdir -p build

  cd build

  cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_SETUID=ON ..

  make
}

package() {
  cd "$pkgname/build"

  make DESTDIR="$pkgdir" install/fast

  cd ..

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE
}

